package com.biglead.demo.utils;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

@Slf4j
public class UUIDUtils {

    public static String uuid() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    /**
     * 根据 ip 地址生成用户的唯一标识
     * @param request
     * @return
     */
    public static String toUserTicket(HttpServletRequest request) {
        String host = request.getRemoteHost();
        log.info("host: {}", host);
        return MD5Utils.md5(host);
    }

}
